// SPDX-License-Identifier: MIT
// SPDX-FileCopyrightText: 2022 Ivan Baidakou

#pragma once

#include "definitions.hpp"
#include "message.hpp"

namespace rotor_light::message {

struct Undef : Message {
  static constexpr auto type_id = MessageType::undef;

  Undef(ActorId to) : Message(to) {}

  MessageTypeId get_type_id() const override { return type_id; }
};

struct ChangeState : Message {
  static constexpr auto type_id = Undef::type_id - 1;

  ChangeState(ActorId to, StateCommand command_)
      : Message(to), command{command_} {}

  MessageTypeId get_type_id() const override { return type_id; }

  StateCommand command;
};

struct ChangeStateAck : Message {
  static constexpr auto type_id = ChangeState::type_id - 1;

  ChangeStateAck(ActorId to, ActorId from_, State state_, bool success_)
      : Message(to), from{from_}, state{state_}, success{success_} {}

  MessageTypeId get_type_id() const override { return type_id; }

  ActorId from;
  State state;
  bool success;
};

struct RefreshTime : Message {
  static constexpr auto type_id = ChangeStateAck::type_id - 1;
  using Message::Message;

  MessageTypeId get_type_id() const override { return type_id; }
};

} // namespace rotor_light::message
